<?php $frmBranch = $this->frmBranch;
$cancel_url = $this->url(array('module'=>'users','controller'=>'index','action'=>''),null,true);
$cancel_url_change = $this->url(array('module'=>'users','controller'=>'index','action'=>'change-password'),null,true);
?>
<style>
dt{ display: none;}
</style>
<div class="row">
	<div class="col-lg-12">
		<div class="box" style="width: 95%; margin: 0 auto;">
			<header class="dark">
				<div class="icons"><i class="icon-ok"></i></div>
					<h5>បន្ថែមប្រភេទអ្នកប្រើប្រាស់</h5>
                    <div class="toolbar">
                    	<ul class="nav">
							<li>
	                            <div class="btn-group" style="padding: 10px;">
	                            	<a class="accordion-toggle btn btn-xs minimize-box" data-toggle="collapse" href="#collapse2">
	                                	<i class="icon-chevron-up"></i>
	                                </a>
	                                <button class="btn btn-xs btn-primary close-box"><i class="icon-group"></i></button>
	                            </div>
                            </li>
                     	</ul>
                	</div>
          	</header>
			<div id="collapse2" class="body collapse in">
				<form class="form-horizontal" id="popup-validation" enctype="multipart/form-data" method="post">
                    
               		<div style="float: left; text-align: left;" class="control-label col-lg-9">
               		<?php echo $frmBranch->getElement('id');?>
						<div class="form-group">
	                    	<label class="control-label col-lg-4">​​​ខេត្ត ក្រុង/Location :​ </label>
	                        <div class="col-lg-6">
	                        	<?php echo $frmBranch->getElement('location');?>
	                        </div>                        
	               		</div>
	               		
	               		<div class="form-group">
	                    	<label class="control-label col-lg-4"> ឈ្មោះទីតាំង  / Branch Name : </label>
	                        <div class="col-lg-6">
	                        	<?php echo $frmBranch->getElement('branch');?>
	                        </div>
	               		</div>
	               		<div class="form-group">
	                    	<label class="control-label col-lg-4"> អាស័យដ្ឋាន / Address : </label>
	                        <div class="col-lg-6">
	                        	<?php echo $frmBranch->getElement('address');?>
	                        </div>
	               		</div>
	               		<div class="form-group">
	                    	<label class="control-label col-lg-4"> ពិពណ៌នា / Description : </label>
	                        <div class="col-lg-6">
	                        	<?php echo $frmBranch->getElement('description');?>
	                        </div>
	               		</div>
	               		<div class="form-group">
	                    	<label class="control-label col-lg-4"> ស្ថានភាព / Status : </label>
	                        <div class="col-lg-6">
	                        	<?php echo $frmBranch->getElement('status');?>
	                        </div>
	               		</div>
	               		
               		</div>
                   <div class="form-group">
                    	<label class="control-label col-lg-4">  </label>
                        <div class="col-lg-6">
                        	<button type="submit" id="save" name="save" class="btn btn-primary btn-grad"><i class="icon-refresh icon-white"> </i> កែប្រែ</button>
                        	<button type="submit" id="save_add" name="save_add" class="btn btn-primary btn-grad"><i class="icon-save"> </i> កែប្រែ & បន្ថែមថ្មី</button>
                        	<button type="submit" id="save_close" name="save_close" class="btn btn-primary btn-grad"><i class="icon-pencil icon-white"> </i> កែប្រែ​​ និង​ ចាកចេញ</button>                        		
                        	<a href="<?php echo $cancel_url; ?>"><button​ type="button" class="btn btn-primary btn-grad"><i class="icon-remove-sign"> </i> ចាកចេញ</button></a>
                        </div>
               		</div>
           	 	</form>
           	</div>
		</div>
	</div>
</div>
<script>
<?php $getfillter_add =  $this->url(array('module'=>'users','controller'=>'user-type','action'=>'getfillteradd')); ?>
function getfillterUserType(){
	user_type = $('#user_type').val();
	$.ajax({
		url:"<?php echo $getfillter_add;?>",
		type:"post",
		data:{'user_type':user_type},
		success: function(data){	
			user_type = $.parseJSON(data);					
			if(user_type!=null){
				 for (var index = 1; index <= user_type.length; index++) {
					 alert(user_type[index-1]['user_type']+" is Already Exist!!");
				}
				 document.getElementById("user_type").style.borderColor="#FF0000";
				 document.getElementById("user_type").style.color="#FF0000";
				 document.getElementById("save").setAttribute('disabled', 'disabled');
				 document.getElementById("save_close").setAttribute('disabled', 'disabled');
			}else{
				document.getElementById("save").disabled = false;
				document.getElementById("save_close").disabled = false;
				document.getElementById("user_type").style.borderColor="";
				document.getElementById("user_type").style.color="#000";
			}
		},
		error:function(){
		}
	});
}
</script>